package com.gdut.simple.model.impl;

import com.gdut.simple.common.RequestCallback;
import com.gdut.simple.data.entity.User;
import com.gdut.simple.model.IUpdateInfoModel;

import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.UpdateListener;

public class UpdateBirthdayModelImpl implements IUpdateInfoModel {

    @Override
    public void update(User user, String value, final RequestCallback<String> callback) {
        final User newUser = new User();
        newUser.setBirthday(value);
        newUser.update(user.getObjectId(), new UpdateListener() {
            @Override
            public void done(BmobException e) {
                if (e == null) {
                    if (callback != null) {
                        callback.onSuccess("修改成功");
                    }
                } else {
                    if (callback != null) {
                        callback.onFailure(e.getMessage());
                    }
                }
            }
        });
    }

}
